package com.wzb.eye100.util;

import android.content.Context;
import android.content.res.Resources;

import com.wzb.eye100.interf.WApplication;

/**
 * @author wzb<wangzhibin_x@qq.com>
 * @date May 5, 2017 10:25:30 AM
 */
public class ResTools {

	public static String getResString(Context context, int id) {
		Resources res = context.getResources();
		return res.getString(id);
	}

	/**
	 * 此处有个坑
	 * 传入application context 获取string时,在app内切换语音后不生效.
	 * 必须传入activity的context才可以
	 * @param id
	 * @return
	 */
	public static String getString(int id) {
		Resources res = WApplication.CONTEXT.getResources();
		return res.getString(id);
	}

	public static String getString(Context context,int id) {
		Resources res = context.getResources();
		return res.getString(id);
	}

	public static String[] getResStringArray(Context context, int id) {
		Resources res = context.getResources();
		return res.getStringArray(id);
	}

	public static String[] getResStringArray(int id) {
		Resources res = WApplication.CONTEXT.getResources();
		return res.getStringArray(id);
	}
}
